import 'dart:io';

typedef HeaderMap = Map<String, List<String>>;

extension ExHttpHeaders on HttpHeaders {
  HeaderMap toFullMap() {
    final HeaderMap headers = {};
    forEach((name, values) {
      headers[name] = values;
    });
    return headers;
  }
}

final blockedHeaders = {
  'accept-language',
  'authorization',
  'cdn-loop',
  'cf-connecting-ip',
  'cf-ipcountry',
  'cf-ray',
  'cf-visitor',
  'content-length',
  'host',
  'priority',
  'sec-ch-ua',
  'sec-ch-ua-mobile',
  'sec-ch-ua-platform',
  'sec-fetch-dest',
  'sec-fetch-mode',
  'sec-fetch-site',
  'sec-fetch-user',
  'upgrade-insecure-requests',
  'x-forwarded-for',
  'x-forwarded-host',
  'x-forwarded-proto',
  'x-request-id',
};

extension ExHeaderMap on HeaderMap {
  HeaderMap toSimpleMap() {
    final HeaderMap headers = {};
    forEach((name, values) {
      headers[name] = values;
    });
    blockedHeaders.forEach(headers.remove);
    return headers;
  }
}